package com.team2.outpatient_sys.dao;

import com.team2.outpatient_sys.pojo.Dispense;
import com.team2.outpatient_sys.pojo.ProvideMedicine;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProvideMedicineDao {

    @Insert("insert into provide_medicine values(null,#{patientId},#{dispenseId},#{time})")
    public Integer add(ProvideMedicine provideMedicine);

    @Delete("delete from provide_medicine where id=#{id}")
    public Integer delete(Integer id);

    @Update("update provide_medicine set patient_id = #{patientId},dispense_id=#{dispenseId},time=#{time} where id=#{id}")
    public Integer update(ProvideMedicine provideMedicine);

    @Select("select * from provide_medicine")
    public List<ProvideMedicine> findAll();

    @Select("select * from provide_medicine where id=#{id}")
    public ProvideMedicine findById(Integer id);


    //根据配药表查询发药表
//    @Select("SELECT dispense.*\n" +
//            "FROM medicine,patient,provide_medicine,pharmacy_storage,dispense\n" +
//            "WHERE patient.id=provide_medicine.patient_id AND dispense.id=provide_medicine.dispense_id")
//    public List<Dispense> findProvideMedicine(Integer patientId,Integer dispenseId);


}
